﻿using Mozi.NTP.Generic;
using System;

namespace Mozi.NTP
{
    /// <summary>
    /// 时钟类型
    /// </summary>
    public class ClockIdentifier : AbsClassEnum
    {
        public static ClockIdentifier GOES = new ClockIdentifier("GOES", "Geostationary Orbit Environment Satellite");
        public static ClockIdentifier GPS = new ClockIdentifier("GPS\0", "Global Position System");
        public static ClockIdentifier GAL = new ClockIdentifier("GAL\0", "Galileo Positioning System");
        public static ClockIdentifier PPS = new ClockIdentifier("PPS\0", "Generic pulse-per-second");
        public static ClockIdentifier IRIG = new ClockIdentifier("IRIG", "Inter-Range Instrumentation Group");
        public static ClockIdentifier WWVB = new ClockIdentifier("WWVB", "LF Radio WWVB Ft. Collins, CO 60 kHz");
        public static ClockIdentifier DCF = new ClockIdentifier("DCF\0", "LF Radio DCF77 Mainflingen, DE 77.5 kHz");
        public static ClockIdentifier HBG = new ClockIdentifier("HBG\0", "LF Radio HBG Prangins, HB 75 kHz");
        public static ClockIdentifier MSF = new ClockIdentifier("MSF\0", "LF Radio MSF Anthorn, UK 60 kHz");
        public static ClockIdentifier JJY = new ClockIdentifier("JJY\0", "LF Radio JJY Fukushima, JP 40 kHz, Saga, JP 60 kHz");
        public static ClockIdentifier LORC = new ClockIdentifier("LORC", "MF Radio LORAN C station, 100 kHz");
        public static ClockIdentifier TDF = new ClockIdentifier("TDF\0", "MF Radio Allouis, FR 162 kHz");
        public static ClockIdentifier CHU = new ClockIdentifier("CHU\0", "HF Radio CHU Ottawa, Ontario");
        public static ClockIdentifier WWV = new ClockIdentifier("WWV\0", "HF Radio WWV Ft. Collins, CO");
        public static ClockIdentifier WWVH = new ClockIdentifier("WWVH", "HF Radio WWVH Kauai, HI");
        public static ClockIdentifier NIST = new ClockIdentifier("NIST", "NIST telephone modem");
        public static ClockIdentifier ACTS = new ClockIdentifier("ACTS", "NIST telephone modem");
        public static ClockIdentifier USNO = new ClockIdentifier("USNO", "USNO telephone modem");
        public static ClockIdentifier PTB = new ClockIdentifier("PTB\0", "European telephone modem");
        public static ClockIdentifier LOCL = new ClockIdentifier("LOCL", "uncalibrated local clock");
        public static ClockIdentifier CESM = new ClockIdentifier("CESM", "calibrated Cesium clock");
        public static ClockIdentifier RBDM = new ClockIdentifier("RBDM", "calibrated Rubidium clock");
        public static ClockIdentifier OMEG = new ClockIdentifier("OMEG", "OMEGA radionavigation system");
        public static ClockIdentifier DCN = new ClockIdentifier("DCN\0", "DCN routing protocol");
        public static ClockIdentifier TSP = new ClockIdentifier("TSP\0", "TSP time protocol");
        public static ClockIdentifier DTS = new ClockIdentifier("DTS\0", "Digital Time Service");
        public static ClockIdentifier ATOM = new ClockIdentifier("ATOM", "Atomic clock (calibrated)");
        public static ClockIdentifier VLF = new ClockIdentifier("VLF\0", "VLF radio (OMEGA,, etc.)");
        public static ClockIdentifier FREE = new ClockIdentifier("FREE", "(Internal clock)");
        public static ClockIdentifier INIT = new ClockIdentifier("INIT", "(Initialization)");
        public static ClockIdentifier Unknown = new ClockIdentifier("\0\0\0\0", "NULL");

        public string Name { get; set; }
        public string Description { get; set; }
        protected override string Tag { get { return Name; } }

        public byte[] Pack
        {
            get
            {
                byte[] data = new byte[4];
                Array.Copy(System.Text.Encoding.ASCII.GetBytes(Name), data, Name.Length > 4 ? 4 : Name.Length);
                return data;
            }
        }

        public ClockIdentifier(string name, string desc)
        {
            Name = name;
            Description = desc;
        }

        //public static ClockIdentifier Parse()
        //{

        //}
    }
}
